import java.time.LocalDateTime;

public class Ticket {
    private String ticketId;
    private Show show;
    private int seatRow;
    private int seatCol;
    private LocalDateTime createTime;
    private boolean isRefunded;

    public Ticket(String ticketId, Show show, int seatRow, int seatCol) {
        this.ticketId = ticketId;
        this.show = show;
        this.seatRow = seatRow;
        this.seatCol = seatCol;
        this.createTime = LocalDateTime.now();
        this.isRefunded = false;
    }

    // 检查是否可退票（放映前1小时）
    public boolean canRefund() {
        return !isRefunded && LocalDateTime.now().isBefore(show.getShowTime().minusHours(1));
    }

    // Getters and Setters
    public String getTicketId() { return ticketId; }
    public Show getShow() { return show; }
    public int getSeatRow() { return seatRow; }
    public int getSeatCol() { return seatCol; }
    public LocalDateTime getCreateTime() { return createTime; }
    public boolean isRefunded() { return isRefunded; }
    public void setRefunded(boolean refunded) { isRefunded = refunded; }
}
    